* use "es_data-v2_0/es_data-v2_0.dta"
* https://files.nyu.edu/mrg217/public/elections.html

keep if country=="Australia" | country=="Austria" | country=="Belgium" | country=="Canada" | country=="Denmark" | country=="Finland" | country=="France" | country=="Germany" | country=="Greece" | country=="Iceland" | country=="Ireland" | country=="Italy" | country=="Japan" | country=="Luxembourg" | country=="Netherlands" | country=="New Zealand" | country=="Norway" | country=="Portugal" | country=="Spain" | country=="Sweden" | country=="Sweden " | country=="Switzerland" | country=="United Kingdom" | country=="United States of America" | country=="West Germany"

*keep if year>1969
*for prices analysis

keep if year>1944

replace country="Germany" if country=="West Germany"

replace country="United States" if country=="United States of America"

replace country="Sweden" if country=="Sweden "

keep if presidential==0

keep country year legislative_type elecrule tier1_formula seats tier1_districts tier1_avemag enep enep_others enep1 enpp enpp_others enpp1

*drop if tier1_avemag==.

duplicates drop country year if country=="Greece", force

duplicates drop country year if country=="Ireland", force

duplicates drop country year if country=="United Kingdom", force

duplicates drop country year if country=="Denmark", force

duplicates drop country year if country=="Iceland", force

gen elecyr=year

replace elecyr=elecyr-1900 if elecyr<2000

save "~/_third_party_data/Golder/avemag.dta", replace
